package com.lam.schedule.common.scheduler.model;

import java.util.Map;

import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.lam.common.utils.IpUtils;
import com.lam.schedule.entity.ScheduleJob;
import com.lam.schedule.entity.ScheduleJobLog;

public class ManualAsyncJob extends AsyncJob {
	
	public void run(ScheduleJob scheduleJob, Map<String, Object> exeParam, ScheduleJobLog jobLog) {
		jobLog.setInstanceIp(IpUtils.getHostIp());
		jobLog.setInstanceId(String.format("%s.%s", IpUtils.getHostName(), IdWorker.getId()));
		jobLog.setInstanceName(String.format("%s-%s", jobLog.getInstanceIp(), jobLog.getInstanceId()));
		jobLog.setSchedName("AsyncScheduledExecutor");
		runJob(scheduleJob, exeParam, jobLog);
	}

}
